package com.ojoin.trade.t0loan_core.web.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.ojoin.trade.common.SqlId;
import com.ojoin.trade.common.exception.BusinessException;
import com.ojoin.trade.common.exception.DaoException;
import com.ojoin.trade.common.web.dao.impl.BaseDaoImpl;
import com.ojoin.trade.t0loan_core.web.dao.TbAgentpayLogDao;
import com.ojoin.trade.t0loan_core.web.domain.TbAgentpayLog;

@Repository
public class TbAgentpayLogDaoImpl extends BaseDaoImpl<TbAgentpayLog> implements TbAgentpayLogDao{ 
    
	public List<TbAgentpayLog> queryByCode(String respCode){
		String mapMethodName = "selectByCode";
		try {
			return sqlSessionTemplate.selectList(getSqlName(mapMethodName), respCode);
		} catch (Exception e) {
			throw new DaoException(String.format("查询对象列表出错！语句：%s", getSqlName(SqlId.SQL_SELECT)), e);
		}
	}
	
	public TbAgentpayLog queryByReqId(String reqId){
		String mapMethodName = "selectByReqId";
		try {
			return sqlSessionTemplate.selectOne(getSqlName(mapMethodName), reqId);
		} catch (Exception e) {
			throw new DaoException(String.format("请求ID:" + reqId + " 查询处理过的FTP文件出错！语句：%s",
					getSqlName(mapMethodName)), e);
		}
	}

	@Override
	public List<TbAgentpayLog> selectByCondition(TbAgentpayLog vo) throws BusinessException {
		String mapMethodName = "selectByCondition";
		try {
			return sqlSessionTemplate.selectList(getSqlName(mapMethodName), vo);
		} catch (Exception e) {
			throw new DaoException(String.format("查询对象列表出错！语句：%s", getSqlName(mapMethodName)), e);
		}
	}

	@Override
	public void updateByCondition(TbAgentpayLog vo) throws BusinessException {
		String mapMethodName = "updateByCondition";
		try {
			sqlSessionTemplate.update(getSqlName(mapMethodName), vo);
		} catch (Exception e) {
			throw new DaoException(String.format("更新对象出错！语句：%s", getSqlName(mapMethodName)), e);
		}
	}
	
	
}